package gsp420;

import java.io.FileInputStream;
import java.io.InputStreamReader;

public class Map
{
	char[][] m_map;
	
	void load(String filename)
	{
		try
		{
			FileInputStream fis = new FileInputStream(filename); 
			InputStreamReader in = new InputStreamReader(fis, "UTF-8");
			int inputLetter = in.read();	// read the width char
			int w = inputLetter-'0';
			in.read();	// skip the next char
			inputLetter = in.read();		// read the height char
			in.read();	// skip the end line
			int h = inputLetter-'0';
			m_map = new char[h][w];
			for(h = 0; h < m_map.length; ++h)
			{
				for(w = 0; w < m_map[h].length; ++w)
				{
					do{
					inputLetter = in.read();
					}while(inputLetter == '\n' || inputLetter == '\r');
					m_map[h][w] = (char)inputLetter;
				}
			}
		}catch(Exception e)
		{
		}
	}
	void print()
	{
		for(int h = 0; h < m_map.length; ++h)
		{
			for(int w = 0; w < m_map[h].length; ++w)
			{
				System.out.print(m_map[h][w]);
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args)
	{
		Map m = new Map();
		m.load("a.txt");
		m.print();
	}
}
